package xml;

//import java.io.IOException;
//import java.io.UnsupportedEncodingException;
//import org.dom4j.Document;
//import org.dom4j.DocumentException;
//import org.dom4j.io.OutputFormat;
//import org.dom4j.io.SAXReader;
//import org.dom4j.io.XMLWriter;
//import org.dom4j.util.XMLErrorHandler;
//import org.xml.sax.SAXException;

public class Schema_dom4j {
//	public static void main(String[] args){
//	SAXReader reader = new SAXReader();  
//	  
//    reader.setValidation(true);  
//    try {  
//        reader.setFeature("http://xml.org/sax/features/validation", true);  
//        reader.setFeature("http://apache.org/xml/features/validation/schema", true);  
//
//        reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",  
//                                        "C:\\Users\\Administrator\\workspace\\Graduate\\test.xsd");  
//
//        XMLErrorHandler errorHandler = new XMLErrorHandler();  
//        reader.setErrorHandler(errorHandler);  
//
//        Document document = reader.read("C:\\Users\\Administrator\\workspace\\Graduate\\test.xml");  
//        XMLWriter writer = new XMLWriter(OutputFormat.createPrettyPrint());  
//        if (errorHandler.getErrors().hasContent()) {  
//                writer.write(errorHandler.getErrors());  
//        } else {  
//                System.out.println("validate success.");  
//        }  
//    } catch (SAXException e) {  
//        e.printStackTrace();  
//    } catch (DocumentException e) {  
//        e.printStackTrace();  
//    } catch (UnsupportedEncodingException e) {  
//        e.printStackTrace();  
//    } catch (IOException e) {  
//        e.printStackTrace();  
//    }  
//    finally
//    {
//    	
//    }
//      
//}  
}

